#include <stdio.h>
#include "NMEA0183.h"


int main(int argc, char const *argv[]) {
  /* code */
  char nmea[] = "$GNRMC,075939.00,A,3025.49328063,N,11425.07221719,E,0.031,201.2,300724,4.7,W,A,C*5A\r\n$GNHDT,70.5832,T*20\r\n$GNGGA,075939.00,3025.49328063,N,11425.07221719,E,1,26,0.6,36.1591,M,-13.7785,M,,*65\r\n";

  NMEA0183 nmea0183;

  for (int index = 0; index < sizeof(nmea); index++) {
    if (nmea_decode(&nmea0183, nmea[index])) {
      printf("nmea decode ok\n");
      printf("gpsParse.parity: 0x%x\n", nmea0183.gpsParse.parity);
      printf("gpsParse.is_checksum_term: 0x%x\n", nmea0183.gpsParse.is_checksum_term);
      printf("gpsParse.term: %s\n", nmea0183.gpsParse.term);
      printf("gpsParse.sentence_type: >> %d\n", nmea0183.gpsParse.sentence_type);
      printf("gpsParse.term_number: %d\n", nmea0183.gpsParse.term_number);
      printf("gpsParse.term_offset: %d\n", nmea0183.gpsParse.term_offset);
      printf("gpsParse.gps_data_good: %d\n", nmea0183.gpsParse.gps_data_good);
      printf("gpsParse.new_time: %d\n", nmea0183.gpsParse.new_time);
      printf("gpsParse.new_date: %d\n", nmea0183.gpsParse.new_date);
      printf("gpsParse.new_latitude: >> %f\n", nmea0183.gpsParse.new_latitude);
      printf("gpsParse.new_longitude: >> %f\n", nmea0183.gpsParse.new_longitude);
      printf("gpsParse.new_altitude: >> %d\n", nmea0183.gpsParse.new_altitude);
      printf("gpsParse.new_speed: >> %f\n", nmea0183.gpsParse.new_speed);
      printf("gpsParse.new_course: %f\n", nmea0183.gpsParse.new_course);
      printf("gpsParse.new_gps_yaw: >> %f\n", nmea0183.gpsParse.new_gps_yaw);
      printf("gpsParse.new_hdop: %d\n", nmea0183.gpsParse.new_hdop);
      printf("gpsParse.new_satellite_count: %d\n", nmea0183.gpsParse.new_satellite_count);
      printf("gpsParse.new_quality_indicator: %d\n", nmea0183.gpsParse.new_quality_indicator);
      printf("gpsParse.last_RMC_ms: %d\n", nmea0183.gpsParse.last_RMC_ms);
      printf("gpsParse.last_GGA_ms: %d\n", nmea0183.gpsParse.last_GGA_ms);
      printf("gpsParse.last_VTG_ms: %d\n", nmea0183.gpsParse.last_VTG_ms);
      printf("gpsParse.last_HDT_ms: %d\n", nmea0183.gpsParse.last_HDT_ms);
      printf("    \n");
      // printf("gpsData.instance: %d\n", nmea0183.gpsData.instance);
      // printf("gpsData.status: %d\n", nmea0183.gpsData.status);
      // printf("gpsData.location.alt: %f\n", nmea0183.gpsData.location.alt);
      // printf("gpsData.location.lat: %f\n", nmea0183.gpsData.location.lat);
      // printf("gpsData.location.lng: %f\n", nmea0183.gpsData.location.lng);
      // printf("gpsData.date_time.year: %d\n", nmea0183.gpsData.date_time.year);
      // printf("gpsData.date_time.month: %d\n", nmea0183.gpsData.date_time.month);
      // printf("gpsData.date_time.day: %d\n", nmea0183.gpsData.date_time.day);
      // printf("gpsData.date_time.week: %d\n", nmea0183.gpsData.date_time.week);
      // printf("gpsData.ground_speed: %f\n", nmea0183.gpsData.ground_speed);
      // printf("gpsData.ground_course: %f\n", nmea0183.gpsData.ground_course);
      // printf("gpsData.gps_yaw: %f\n", nmea0183.gpsData.gps_yaw);
      // printf("gpsData.hdop: %d\n", nmea0183.gpsData.hdop);
      // printf("gpsData.vdop: %d\n", nmea0183.gpsData.vdop);
      // printf("gpsData.num_sats: %d\n", nmea0183.gpsData.num_sats);
      // printf("gpsData.have_gps_yaw: %d\n", nmea0183.gpsData.have_gps_yaw);
      // printf("gpsData.last_gps_time_ms: %d\n", nmea0183.gpsData.last_gps_time_ms);
      printf("-----------------------------\n");
    }
  }

  return 0;
}
